package com.example.demo.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(path = "/test")
public class TestController {

    @GetMapping(value = "/product/{empId}")
    public String getPorcduct(@PathVariable String empId){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return "product id :"+empId;
    }

    @GetMapping(value = "/order/{empId}")
    public String getOrder(@PathVariable String empId){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return "order id:"+empId;
    }

    @GetMapping(value = "/news/{empId}")
    public String getNews(@PathVariable String empId){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return "news id:"+empId;
    }

}
